{extend name="user_base" /} {block name="seo"}
<title>投稿记录 - {$site_config['seo_title']}</title>
<meta name="keywords" content="{$site_config['seo_keyword']}">
<meta name="description" content="{$site_config['seo_description']}">
{/block}
{block name="css"}

{/block}
{block name="main"}
<div class="title">
    数据概述
</div>
<ul class="data-ul layui-clear">
    <li>
        <font class="iconfont icon-shouye-tougao" style="background:#62a1ff;"></font>
        <div>
            <b>{$user.posted_num}</b>
            <span>累计投稿</span>
        </div>
    </li>
    <li>
        <font class="iconfont icon-tongguo" style="background:#38ad23;"></font>
        <div>
            <b>{$user.passed_num}</b>
            <span>通过次数</span>
        </div>
    </li>
    <li>
        <font class="iconfont icon-shibai" style="background:#fd644c;"></font>
        <div>
            <b>{$user.faild}</b>
            <span>失败次数</span>
        </div>
    </li>
</ul>
<div class="title">
    投稿记录
</div>
<div class="loadings layui-icon layui-icon-loading layui-icon layui-anim layui-anim-rotate layui-anim-loop"></div>
<ul class="tg-list"></ul>
{/block}
{block name="script"}
<!-- 投稿列表 -->
<script id="tg-list" type="text/html">
    {{#if(d.count<=0){}}
    <div class="no-data">
        <i class="iconfont icon-zanwu"></i>
        <span>赶快分享您作品给大家吧！</span>
        <a href="/user/tg.html">我要投稿</a>
    </div>
    {{#}else{}}
    {{#  layui.each(d.data, function(index, item){ }}
    <li class="layui-clear">
        {{# var a ;if(item.status===1){}}
        {{# a = ' href="/html/' + item.id + '.html" target="_blank"'}}
        {{#}else{}}
        {{# a = ' href="javaScript:msg();"'}}
        {{#}}}
        <div class="list-img">
            <a {{a}}>
                {{#if(item.status==0){}}
                <img src="/cover_img/{{item.cover_img}}" onerror="this.src='__HOME__/images/no-img1.png';"/>
                {{#}else{}}
                <img src="{{item.cover_img}}" onerror="this.src='__HOME__/images/no-img1.png';"/>
                {{#}}}
            </a>
        </div>
        <div class="list-info">
            <h3 class="list-title">
                {{# var _statusClass,_statusText;if(item.status==1){
                _statusText = '已通过';
                _statusClass = 'success';
                }else if(item.status==2){
                _statusText = '不通过';
                _statusClass = 'bad';
                }else{
                _statusText = '待审核';
                _statusClass = 'wait';
                }}}
                <i class="{{_statusClass}}">
                    {{_statusText}}
                </i>
                <i>
                    {{# if(item.has_attachment){}} 软件 {{#}else{ }} 文章 {{# } }}
                </i>
                <a {{a}}>{{item.title}}</a>
            </h3>
            <div class="list-content">
                {{item.description}}
            </div>
            <div class="btn layui-clear">
                <div class="left">投稿时间：{{item.created_at}}</div>
                <a class="right" data-id='{{item.id}}' href="javaScript:void(0)">查看详情{{#if(item.is_read){}}<span
                        class="layui-badge-dot"></span>{{#} }}</a>
            </div>
        </div>
    </li>
    {{#  }); }}
    {{#}}}
</script>
<!-- 单个详情 -->
<script id="introduce" type="text/html">
    <div class="intr">
        <div class="layui-clear">
            <div class="left"> 投稿标题：</div>
            <div class="right"> {{d.title}}</div>
        </div>
        <div class="layui-clear">
            <div class="left"> 投稿类型：</div>
            <div class="right"> {{d.data_class}}</div>
        </div>
        <div class="layui-clear">
            <div class="left"> 投稿专区：</div>
            <div class="right"> {{d.type_title}}</div>
        </div>
        <div class="layui-clear">
            <div class="left"> 投稿状态：</div>
            <div class="right"> {{#if(d.status==1){}} 已通过 {{#}else if(d.status==2){}} 不通过 {{#}else{}} 待审核 {{#}}}</div>
        </div>
        <div class="layui-clear">
            <div class="left"> 投稿时间：</div>
            <div class="right"> {{d.created_at}}</div>
        </div>
        <div class="layui-clear">
            <div class="left"> 审核时间：</div>
            <div class="right"> {{#if(d.publish_time){}} {{d.publish_time}} {{#}else{}}--{{#}}}</div>
        </div>
        <div class="layui-clear">
            <div class="left"> 审核小编：</div>
            <div class="right"> {{d.nickname||'暂无信息'}}</div>
        </div>
        <div class="layui-clear">
            <div class="left"> 小编QQ：</div>
            <div class="right"> {{d.qq==null?'暂无信息':d.qq+'（奖励未到或其他任何疑问可加QQ询问）'}}</div>
        </div>
        <div class="layui-clear">
            <div class="left"> 小编回复：</div>
            <div class="right"> {{d.reply||'暂无回复'}}</div>
        </div>
        <div class="layui-clear">
            <div class="left"> 奖励金额：</div>
            <div class="right"> {{"￥"+d.money||'暂无奖励'}}</div>
        </div>
        <div class="layui-clear">
            <div class="left"> 奖励备注：</div>
            <div class="right"> {{d.reward_remark||'暂无备注'}}</div>
        </div>
    </div>
</script>
<script>

    var layer;
    layui.use(['laytpl', 'flow', 'layer'], function () {
        var laytpl = layui.laytpl;
        var flow = layui.flow;
        layer = layui.layer;
        //启动流式加载
        flow.load({
            elem: '.tg-list',
            isAuto: false,
            done: function (page, next) {
                request({
                    data: {"page": page},
                    loading: false,
                    success: function (result) {
                        result = result.data;
                        if (page === 1) {
                            $(".loadings").hide();
                            $(".layui-flow-more").show();
                        }
                        if (result.pages === 0) $('.layui-flow-more').hide();
                        laytpl($("#tg-list").html()).render(result, function (html) {
                            next(html, page < result.pages);
                        });
                    }
                });
            }
        });

        $(".tg-list").on("click", ".btn .right", function () {
            //弹出投稿详情
            var _id = $(this).data("id");
            var dot = $(this).find(".layui-badge-dot");
            request({
                url: '/user/record_detail/' + _id + '.html',
                // data: {"id": _id},
                success: function (res) {
                    result = res.data;
                    if (result) {
                        if (dot.hasClass("layui-badge-dot")) {
                            dot.remove();
                            var tip = $(".i-nav .layui-badge");
                            var tipnum = parseInt(tip.text());
                            tipnum = tipnum - 1;
                            if (tipnum) {
                                tip.text(tipnum)
                            } else {
                                tip.remove();
                            }
                        }
                        laytpl($("#introduce").html()).render(result.data, function (html) {

                            layer.open({
                                type: 0,
                                shadeClose: true,
                                skin: 'atuikeLayerSkin1 trlayer',
                                content: html,
                                btn: ['我知道了'],
                                area: ['650px', '630px']
                            });
                        });
                    }

                }
            });
        });


    });


    //教程没有链接的时候；
    function msg() {
        layer.msg("待审核或不通过的教程 是无法查看的哦！");
    }
</script>
{/block}